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