UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j4ljPH7OpP+j2dk/ABX8TAegNiQOnP1JACfp+Be+fWA=' 
WHERE 
  key_id = '3ac8ef6298abe765e296a2b93a7dc91055880029fe7e77255455dc09936623c6' 
  AND (
    token = 'j4ljPH7OpP+j2dk/ABX8TAegNiQOnP1JACfp+Be+fWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031