UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BsKrqfMln5KLVSvm/po2ps0wCb661wh2oO1WVKnaJ+c='
WHERE
key_id = '1778f41bb9bd929053fc4b8c083cb9a5b3275dcb940d1eab745c87a558cb03a9'
AND (
token = 'BsKrqfMln5KLVSvm/po2ps0wCb661wh2oO1WVKnaJ+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)