UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KLjqL2oUqt+8cfVKiR5HTA0XUSsW2Li8bQoaEE7GUrQ='
WHERE
key_id = 'a0f18dd65c695b966df2b3ad0559bf2f2f6f3bbfc9ede5a1dfcd73436e8fdb9d'
AND (
token = 'KLjqL2oUqt+8cfVKiR5HTA0XUSsW2Li8bQoaEE7GUrQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)