UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D6KF6PpIMnE3UjUpsp0v4f4W3KzcX/xHalUE7NYYSHM=' 
WHERE 
  key_id = '726debf667b0ee9b85aaf45889f2698de0a87a1cbc3f1177660d117d91887076' 
  AND (
    token = 'D6KF6PpIMnE3UjUpsp0v4f4W3KzcX/xHalUE7NYYSHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037