UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x42fJhSSRFJOaO8CJDGwfU57qgFV1IClhse6tCni4Ao=' 
WHERE 
  key_id = '2afa6fa6cf766904e8852189be69ef660e3b6a945c1793d00e0a678e20b97947' 
  AND (
    token = 'x42fJhSSRFJOaO8CJDGwfU57qgFV1IClhse6tCni4Ao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039