UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5s01AK1jPDsDNV8EIKNPablL7YX4X02on9kd0qE8gY=' 
WHERE 
  key_id = '4876f533432d15235dd4e9aecc1bc78687e0648a1fd376f8a9c5e3b3b5e2c2fa' 
  AND (
    token = 'P5s01AK1jPDsDNV8EIKNPablL7YX4X02on9kd0qE8gY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031