UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q2bEwHI91G4tjnGwWhgnybcUWxSic8u0TDG+Yha1JDc='
WHERE
key_id = '1ef4efdd0b177a78582476d4b548404893065294c1f4d5403f5afe9ee17cbbd5'
AND (
token = 'Q2bEwHI91G4tjnGwWhgnybcUWxSic8u0TDG+Yha1JDc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)