UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8+C+dfIhCKWwjmtV4VkckIfw1VapsII+Ta4MJleWg+M=' 
WHERE 
  key_id = '2218708e991f65b66685fa25c9ae471b1782a3a83d92f259f3d1439eacbde3e2' 
  AND (
    token = '8+C+dfIhCKWwjmtV4VkckIfw1VapsII+Ta4MJleWg+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049