UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm3agsrfomVI8sOhkm6h5dWE9hMNthoYRw2ht/t6aWSo='
WHERE
key_id = '7945712b3315dddd1090a3cf10a70a589c27d95dda51b8b158d18b6914c7eb93'
AND (
token = 'm3agsrfomVI8sOhkm6h5dWE9hMNthoYRw2ht/t6aWSo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)