UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rOFoeIlokHXCOqbk3paYmitPOLHhvkfwHOiimyQc0D8=' 
WHERE 
  key_id = '100912dc7abe9afbb5ec9fcb168793b9ea81489009dbad66d55cfb722139a50f' 
  AND (
    token = 'rOFoeIlokHXCOqbk3paYmitPOLHhvkfwHOiimyQc0D8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031