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

Query time 0.00040