UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mg9tr8qMFK4/yVBGtfju8coU+Mycj0DYBgauOPmP6iM='
WHERE
key_id = 'f8521589e23f036a353f390c2ee3a3d7dfce4928abb6a627a74263a53e092860'
AND (
token = 'Mg9tr8qMFK4/yVBGtfju8coU+Mycj0DYBgauOPmP6iM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)