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