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