UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'inqACveqxYddK8LhjztRhfYGFCZFAcno3wE6UE9BL+I=' 
WHERE 
  key_id = '887d6338d398f3a8b00c02a79951d6cca96f98b0247bb8ff8eff45337e32bc47' 
  AND (
    token = 'inqACveqxYddK8LhjztRhfYGFCZFAcno3wE6UE9BL+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034