UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I24YR7JaH3xk6wFJI1i71UKYtw1/dBPbORqu7Gu8nDU='
WHERE
key_id = 'e16a7167b4b27f7caa248a8c054a80d78f8e6421bf4979bac7ae06978dd5b1ff'
AND (
token = 'I24YR7JaH3xk6wFJI1i71UKYtw1/dBPbORqu7Gu8nDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)