UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cirkkKC6MAnrfLaHdur6XCkowKY8eFdzk44ox7Zyi2o=' 
WHERE 
  key_id = 'e4f5d3052c12f8b2dde7649e21bdaadb2c280e8350053d068aba6954279c1b29' 
  AND (
    token = 'cirkkKC6MAnrfLaHdur6XCkowKY8eFdzk44ox7Zyi2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048