UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q3GN5+/TzARff8WA3Mj0WVN9SJgTKBNJs+RuoUav+44='
WHERE
key_id = 'adafe5502327e3e6b3e168644df268b030280b2fa90de3f7a1e9b07052d72ebf'
AND (
token = 'Q3GN5+/TzARff8WA3Mj0WVN9SJgTKBNJs+RuoUav+44='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)