UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DBPssP36+zS0lHE2OtgzPVbIdh6BDMGLx+7/RDu0k3U='
WHERE
key_id = 'c73f9e837dc0ab908b0fdafab89b2753d6a31fbe16f4dde23a1410ba4598834e'
AND (
token = 'DBPssP36+zS0lHE2OtgzPVbIdh6BDMGLx+7/RDu0k3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)