UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cuLwf191b5g26KyVP2FntD5Y3vOEiPhGVzTQIj0Q96g=' 
WHERE 
  key_id = '29178ae59ef866d88994e14242c1e9f23052f2f360a05e5758792087eb68b5e2' 
  AND (
    token = 'cuLwf191b5g26KyVP2FntD5Y3vOEiPhGVzTQIj0Q96g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029