UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K6yVX0DnRqQxlY3Z7phcCGIoYHnqhmgZDSQ5WPzdb+Y='
WHERE
key_id = 'a9fe97221e77286a237ae3ece183a3e3a322c9d05aec0e0c3794451eba6dac38'
AND (
token = 'K6yVX0DnRqQxlY3Z7phcCGIoYHnqhmgZDSQ5WPzdb+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)