UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jeYxwLveGfYhTbw71+btQqGUhRwTwTEy1r42GPHr0Co=' 
WHERE 
  key_id = '46c402284df015443243ea04b5f743cc714fcac0280e840a8a69685b0b2062e8' 
  AND (
    token = 'jeYxwLveGfYhTbw71+btQqGUhRwTwTEy1r42GPHr0Co=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040