UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VLUaPKpOsLz51ekiVRgkNLQJiUGHnXzv2Gj+hA5guBQ=' 
WHERE 
  key_id = '82a52fde3abb24b663b074688308674e2e864b5acee966f59fca5927e0e8301b' 
  AND (
    token = 'VLUaPKpOsLz51ekiVRgkNLQJiUGHnXzv2Gj+hA5guBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032