UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sUfB23rQcIyp/zBxBQ/vGOo2Uqi31hyXliX+MLk2CzQ=' 
WHERE 
  key_id = 'd97c038bdcd6e44b93fd0b98234008e81b1967a42fc3463f9907c03ae8cf92e5' 
  AND (
    token = 'sUfB23rQcIyp/zBxBQ/vGOo2Uqi31hyXliX+MLk2CzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033