UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r1o6q+BhbQ2G8mJbJejM2VYCX9IMLyfSFyfQeu5Erl8='
WHERE
key_id = 'cf0bdb839f3fe141e5084d1b5585a643006aa5b91126108b75eb6fba14f27deb'
AND (
token = 'r1o6q+BhbQ2G8mJbJejM2VYCX9IMLyfSFyfQeu5Erl8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)