UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RCHph7th+RgJBIp8BUOIvFWUKJeKwNJ8r7gN5h79MMg=' 
WHERE 
  key_id = '6a585ada110d005b520c764b86f3f3de297aa9278a9d6a44e5c72e83df78215a' 
  AND (
    token = 'RCHph7th+RgJBIp8BUOIvFWUKJeKwNJ8r7gN5h79MMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043