UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UatNv//MgCpW/vSv4zvoMN+0YS5l5X7ThJ+GnWF7Fmo='
WHERE
key_id = 'd7940da282d4c8539485b9d4c1203081a4ee55c72b982a9d46d3e1c6de21cf46'
AND (
token = 'UatNv//MgCpW/vSv4zvoMN+0YS5l5X7ThJ+GnWF7Fmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)