UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qnr0re9+L7GKq2apzOF+JLMyh0zpRTSJwxrwau806tU=' 
WHERE 
  key_id = '06fbaba89dbfefc91d028924400eb0c11877d62bd7c1b26699c34fc598415799' 
  AND (
    token = 'qnr0re9+L7GKq2apzOF+JLMyh0zpRTSJwxrwau806tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020