UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8E2Z2iY31U8CsE7WdjKbeAQ1WqbgnNp7RO+OVSEzyO0=' 
WHERE 
  key_id = '65ac1307e12284518495496997e5f19c52ec391f57b6e397d0a433c4d5f6f9c2' 
  AND (
    token = '8E2Z2iY31U8CsE7WdjKbeAQ1WqbgnNp7RO+OVSEzyO0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031