UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd3YCn/CncW73uTfyF1EbBgNzQaekf0xc+nI1k5OZWAU='
WHERE
key_id = '12d6f4ac7fc7aaf99e66d23e19278638f1eaef6bb5734dfc2f1d975dcc33edb1'
AND (
token = 'd3YCn/CncW73uTfyF1EbBgNzQaekf0xc+nI1k5OZWAU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)