UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CZs4MZe2IhxhaVYd7YNnnPZDmQiBUoGDTsSqOw8wt4c='
WHERE
key_id = '315153b721597777859e242cab9d54925943468081595241da2c399216f4f303'
AND (
token = 'CZs4MZe2IhxhaVYd7YNnnPZDmQiBUoGDTsSqOw8wt4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)