UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w41vTe2I5Ghm0rLXUO/UONa8OIvCu9CO0fhikGvXFFE=' 
WHERE 
  key_id = 'b389134a5d1470726d98523e017f97f84996a5b799b7ed5e12473f81dc519254' 
  AND (
    token = 'w41vTe2I5Ghm0rLXUO/UONa8OIvCu9CO0fhikGvXFFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046