UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RnDRx001ac7kdbw5ZiCFOd+3Uj7A/gVSdRdHlyJORz0='
WHERE
key_id = 'c99d490631a45e4d78ff25cb9392a0b1233d39a54ecc3f7d4bd0edaf3c25397f'
AND (
token = 'RnDRx001ac7kdbw5ZiCFOd+3Uj7A/gVSdRdHlyJORz0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)