UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jtlGZME3Yi2bUM9YbyyWKpCldohtApQmWssIyguHJ58=' 
WHERE 
  key_id = '248452bc021b018eaccd5f583302538ecb3c425de6c60bff9ab0462087caf643' 
  AND (
    token = 'jtlGZME3Yi2bUM9YbyyWKpCldohtApQmWssIyguHJ58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035