UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bTwwEQhBe2FNjQkOFRYhryzuyefmhFMUjM1Ehj7KNBA='
WHERE
key_id = '0692c27c8b094295d3f6f281a4ab3011565f220c9ebb4daa2224d32d1793a4d5'
AND (
token = 'bTwwEQhBe2FNjQkOFRYhryzuyefmhFMUjM1Ehj7KNBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)