UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QFUT98GlvxElyaRkC9gE0swLPBk4a9vN1YIyCYnlAyk='
WHERE
key_id = 'ae1771afb761babdaed38acb869fcf98c4f318ed040ce469f0d0f1253719c314'
AND (
token = 'QFUT98GlvxElyaRkC9gE0swLPBk4a9vN1YIyCYnlAyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)