UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KRkcpcUB2gDnWzO8nYNmGXM5zFFTRgt23XprpJDEfak='
WHERE
key_id = '0fe465fead4feaaa99fb370594ffffe642a2668357a66bfd10895f1c01ea0560'
AND (
token = 'KRkcpcUB2gDnWzO8nYNmGXM5zFFTRgt23XprpJDEfak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)