UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b1Fb01qZ7kS4tTnZHikeK7jz04FbGiyLIFQGrTrM3Yk='
WHERE
key_id = '5516aaa4f38dced6d067b2c8e6c49ebf745cec3d4b1280078deb3bc62a70f9f3'
AND (
token = 'b1Fb01qZ7kS4tTnZHikeK7jz04FbGiyLIFQGrTrM3Yk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)