UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ne4Iy4nqweEJfaWzaOfha5ZQ03hGw6G0uAO8ToGZtwU=' 
WHERE 
  key_id = '4eca351431f124547892e5c99130cf45628d373b0f1832ffadb5944d72b68d2d' 
  AND (
    token = 'ne4Iy4nqweEJfaWzaOfha5ZQ03hGw6G0uAO8ToGZtwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031