UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mWeOI1raqxFqXxpxvf2PfmHw/c5yzLdxvEMfTITtCF8='
WHERE
key_id = '6883f520b9832a1b4f38b72b09029a7101d99382380a6f2d8bd2a42e03d2922f'
AND (
token = 'mWeOI1raqxFqXxpxvf2PfmHw/c5yzLdxvEMfTITtCF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)