UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cPxSUkOVGKI6D8wcunRD/o+egBaMXUa+cBTdL3I4V4I='
WHERE
key_id = 'e8a592230de8732d49931d20535d214b6f316ded962953127884d38f00621afd'
AND (
token = 'cPxSUkOVGKI6D8wcunRD/o+egBaMXUa+cBTdL3I4V4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)