UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MY43Z5WUeUMYYC4SjcFE2MG7QaTQC6f9BIPI1AdLYXY='
WHERE
key_id = '6d2c873db8584a097c8d63808faf6de5940cf6a8e60add194ac8d3fffd61f41d'
AND (
token = 'MY43Z5WUeUMYYC4SjcFE2MG7QaTQC6f9BIPI1AdLYXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)