UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LmSQbVCdVbVJFaBZcXsNW/PDRyB2Eij3r2GngvNJEw8='
WHERE
key_id = '507a1e5b58f51dfee35797c72550a0ffc033409341a88b4085eb179693faeea1'
AND (
token = 'LmSQbVCdVbVJFaBZcXsNW/PDRyB2Eij3r2GngvNJEw8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)