UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XD1AHd7vLVgnC2UM2N5Iv3Fjgj5ab7HCffaRVjjmffs='
WHERE
key_id = '06a1600e866b58fdfbfaf155cbb099890cca36bca7859d3cfe4dd2097acf152d'
AND (
token = 'XD1AHd7vLVgnC2UM2N5Iv3Fjgj5ab7HCffaRVjjmffs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)