UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'agJ2+QuJViDUPyy2ivNdXcBgEG3+QHPpw0KdkioLzXk='
WHERE
key_id = 'c86fca310dfefb427d17e5a42e05353ce8138aaf65c1d71dec083b6c209a853c'
AND (
token = 'agJ2+QuJViDUPyy2ivNdXcBgEG3+QHPpw0KdkioLzXk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)