UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '51XfuxvBg+rtRqp32PY5slNqwJ8Ay4ht+ONBgffcHdc=' 
WHERE 
  key_id = '3b8baeda522f071d7b2325066720d8c7a17d834e76bbeaca3f565fdb93ca945f' 
  AND (
    token = '51XfuxvBg+rtRqp32PY5slNqwJ8Ay4ht+ONBgffcHdc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057