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