UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e7pDkY3qk2HwsamJC7SttO+9HnPVbgHqdNOC5ZuZtR8=' 
WHERE 
  key_id = '80310452a5199db32639d4f6525b4a02892500b5ce2c88a47ba0e2548932798f' 
  AND (
    token = 'e7pDkY3qk2HwsamJC7SttO+9HnPVbgHqdNOC5ZuZtR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016