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